﻿using System;
using System.CodeDom;
using System.Web;
using System.Web.UI;

namespace Ue.Infrastructure.UI.SkinnedControls.PageParserFilters
{
    public sealed class GenericUserControlBuilder : FileLevelUserControlBuilder
    {
        internal string UserControlBaseType { get; set; }

        public override void ProcessGeneratedCode(
            CodeCompileUnit codeCompileUnit, 
            CodeTypeDeclaration baseType, 
            CodeTypeDeclaration derivedType, 
            CodeMemberMethod buildMethod, 
            CodeMemberMethod dataBindingMethod)
        {
            //base.ProcessGeneratedCode(codeCompileUnit, baseType, derivedType, buildMethod, dataBindingMethod);
            if (UserControlBaseType != null)
            {
                derivedType.BaseTypes[0] = new CodeTypeReference(this.UserControlBaseType);
            }
        }
    }
}
